<?php
use think\facade\Route;
Route::any('testinfo','Test/Test');//测试接口
Route::any('getToken','Test/getToken');//测试接口
Route::any('buildingCost','Test/buildingCost');//测试接口
Route::any('fapiao','Test/fapiao');//测试接口
Route::any('payCost','Test/payCost');//测试接口
Route::any('exportProof','Test/exportProof');//推送转账充值记录
Route::any('exportOnline','Test/exportOnline');//推送线下充值记录
Route::post('invoice','Request/invoice');//开票接口
Route::post('cost','Request/cost')->middleware(\app\api\middleware\Check::class);//接收缴费单
Route::post('update/cost','Request/upCost')->middleware(\app\api\middleware\Check::class);//更新缴费单
Route::post('merchant/add','Request/addMerchant')->middleware(\app\api\middleware\Check::class);//新增商户
Route::post('merchant/edit','Request/editMerchant')->middleware(\app\api\middleware\Check::class);//编辑商户
Route::post('cost_type/add','Request/costTypeAdd')->middleware(\app\api\middleware\Check::class);//新增费用项
Route::post('cost_type/edit','Request/costTypeEdit')->middleware(\app\api\middleware\Check::class);//编辑费用项

//账号密码登录
Route::any('top_up/notify', 'Notify/top_up'); //预充值回调
Route::any('cost/notify', 'Notify/cost'); // 订单支付回调
Route::any('cost/mergenotify', 'Notify/mergeNotify'); // 多笔订单订单支付回调
Route::any('charge/notify', 'Notify/chargeNotify'); // 水电订单支付回调
Route::any('ticket/notify', 'Notify/ticketNotify'); // 罚单订单支付回调
Route::any('electricity/notify', 'Notify/electricity'); // 订单支付回调
Route::any('electricity/cece', 'Notify/cece'); // 订单支付回调
Route::post('release/login', 'Release/login')->name('login');
Route::post('merchant/login', 'Merchant/login');//商户端授权登录
Route::post('release/Plogin', 'Release/PhoneLogin');//管理端授权登录
Route::post('merchant/Plogin', 'Merchant/PhoneLogin');
Route::post('papers/login', 'Papers/login')->name('login');
Route::post('merchant/auth', 'Merchant/auth');//商户静默授权
Route::post('release/auth', 'Release/auth');//管理静默授权

Route::any('upload', 'Upload/index')->name('login');
Route::get('message','Close/send');//推送发消息
Route::get('getUserInfo','Close/getUserInfo');//同步关注公众号的粉丝

Route::group('', function(){
    Route::post('papers/user','Papers/getPapersUserInfo');  // 通过jwt获取用户信息
    Route::post('release/user','Release/getReleaseUserInfo');  // 通过jwt获取用户信息
    Route::post('release/get','Release/showIdGetUserInfo');  // 通过jwt获取用户信息
    Route::post('release/edit','Release/getIdByLog');  // 通过jwt获取用户信息
    Route::get('release/record','Release/getRecord');  // 通过jwt获取用户信息
    Route::post('merchant/user','Merchant/getUserInfo');  // 获取商户信息
    Route::post('merchant/list','Merchant/toPayCostList');  //用户自主水电费缴纳

    Route::post('merchant/certificate/detail','Merchant/certificateDetail');  //用户自主缴纳明细
    Route::post('merchant/staff/list','Merchant/staffList');  //用户自主水电费缴纳
    Route::post('merchant/staff/detail','Merchant/staffDetail');  //用户自主水电费缴纳
    Route::post('merchant/invoice','Merchant/invoice');//申请开票
    Route::post('merchant/invoiceNew','Merchant/invoiceNew');//申请开票新

    Route::get('merchant/item','Merchant/getCostItem');//获取员工证的费包
    Route::post('merchant/addEmployees','Merchant/addEmployees');//商家添加员工证
    Route::post('merchant/getEmList','Merchant/getEmList');//商家获取办理列表
    Route::post('merchant/getEmDetail','Merchant/getEmDetail');//商家获取详情

    Route::post('cost/utility','Cost/utilityBills');  // 用户自主水电费缴纳
    Route::post('cost/utility/pay','Cost/utilityBillsPay');  //用户自主水电费缴纳
    Route::post('feedback','Feedback/index');  //用户自主水电费缴纳
    Route::post('feedback/list','Feedback/lists');  //用户自主水电费缴纳
    Route::post('feedback/detail','Feedback/detail');  //用户自主水电费缴纳
    Route::post('feedback/reply','Feedback/reply');  //用户自主水电费缴纳
    Route::post('close/getQrcode','Close/getQrcode');//罚单列表获取二维码

    Route::post('release/info','release/getTableInfo');  //获取商户正在使用的电表
    Route::post('release/up','release/upRecord');  //抄表记录提交
    Route::get('notice/list','Notice/NoticeList');//获取公告列表
    Route::get('notice/detail','Notice/NoticeDetail');//获取对应公告详情
    Route::post('notice/read','Notice/confirmRead');//已读公告
    /*报修 商家*/
    Route::get('record/getInfo','RepairRecord/getInfo');//获取报修类型
    Route::get('marrer/getInfo','RepairMarrer/getInfo');//获取报事类型
    Route::post('record/add','RepairRecord/addRecord');//商户提交报修
    Route::post('record/detail','RepairRecord/recordDetail');//报修单详情

    Route::post('record/complete','RepairRecord/complete');//商户端点已完成
    /*报修 物业*/
    Route::get('record/list','RepairRecord/recordList');//物业人员接单
    Route::post('record/pick','RepairRecord/maintainPick');//物业人员接单
    Route::post('record/back','RepairRecord/backRecord');//物业人员退单
    Route::get('record/material', 'RepairRecord/getMaterial'); //物业获取物料
    Route::post('record/master/list','RepairRecord/masterList');//物业人员获取已接单列表
    Route::post('record/submit','RepairRecord/submitRecord');//物业人员提交订单
    Route::get('record/price','RepairRecord/countPrice');//计算价格
    /**获取商户所需任务**/
    Route::post('merchant/Task','Merchant/TaskList');//获取需要上报任务列表
    Route::post('merchant/task_detail','Merchant/TaskDetail');//根据id获取上报任务详情
    /*三关一闭商户*/
    Route::get('close/getInfo','Close/getInfo');//获取商户信息和时间
    Route::post('close/add','Close/addClose');//商户上报三关一闭
    Route::post('close/list','Close/CloseList');//商户获取三关一闭列表
    Route::post('close/update','Close/updateClose');//商户获取三关一闭修改
    Route::post('close/detail','Close/closeDetail');//商户获取三关一闭详情
    /*三关一闭管理*/
    Route::post('close/management/list','Close/ManagementCloseList');//管理获取三关一闭列表
    Route::post('close/up/suggest','Close/upSuggest');//提交审核意见
    Route::get('close/manager/head','Close/managerHead');//管理端三关一闭头部
    Route::get('close/no/list','Close/noReportList');//未上报商户列表
    Route::post('close/ticket','Close/ticketCost');//开罚单
    Route::any('get/ticket','Close/getTicket');//获取罚单类型
    Route::post('close/getBrandInfo','Close/getBrandInfo');//获取品牌信息
    //
    Route::post('Merchant/getBrandInfo','Merchant/getBrandInfo');//获取门店信息
    Route::any('selectBrand','Merchant/selectBrand'); //选择店铺
    Route::post('merchant/addEmployeesNew','Merchant/addEmployeesNew');//商家添加员工证
    Route::post('Employees/list','Employees/getEmployeesList');//商家获取员工列表
    Route::post('Employees/badge','Employees/getUserbadge');//员工获取自己的工作证
    Route::post('Employees/employeesBadge','Employees/getBadge');//商家获取员工证
    Route::post('Employees/eparture','Employees/EmployeeEeparture');//员工离职
    Route::post('Employees/getInfo','Employees/getBadgeInfo');//获取员工信息
    Route::post('Employees/upInfo','Employees/updateInfo');//编辑员工信息
    /*销售上报*/
    Route::post('repair/saleReport','RepairMarrer/saleReport');//销售上报
    Route::post('repair/saleReportNew','RepairMarrer/saleReportNew');//销售上报新
    Route::any('repair/saleList','RepairMarrer/saleList');//已上传列表
    Route::any('repair/saleDetail','RepairMarrer/saleDetail');//销售上报详情
    Route::any('repair/getNoReport','RepairMarrer/getNoReport');//获取未上报以及被拒绝的日期
    Route::post('notice','Notice/index'); //获取最新公告
    Route::get('notice/list','Notice/NoticeList');//获取公告列表
    Route::get('notice/detail','Notice/NoticeDetail');//获取对应公告详情
    Route::post('notice/read','Notice/confirmRead');//已读公告
    Route::post('notice/apply','Notice/noticeApply');//报名
    Route::post('repair/add','RepairMarrer/addRecord');//报事提交
    Route::post('repair/addNew','RepairMarrer/addRecordNew');//报事提交
    Route::any('repair/list','RepairMarrer/marrerList');//报事列表
    Route::post('repair/detail','RepairMarrer/marrerDetail');//报事详情
    Route::post('merchant/update/password','Merchant/UpdatePassword');  //修改密码
    Route::post('merchant/apply/close','Merchant/applyTask');//商户申报三关一闭
    Route::post('Merchant/receipt','Merchant/costReceipt');//获取收据
    Route::post('Merchant/receiptNew','Merchant/costReceiptNew');//获取收据新
    Route::get('update/cost','Merchant/updateCost');//更新商户账单
    Route::any('get/ticket','Close/getTicket');//获取罚单类型

    Route::post('release/Task','Release/TaskList');//管理端获取需要上报任务列表
    Route::post('release/task_detail','Release/TaskDetail');//根据id获取上报任务详情
    Route::get('release/close/getInfo','Close/getMerInfo');//获取所有商户信息和时间
    Route::post('release/close/getStoreInfo','Close/getStoreInfo');//获取对应租户门店信息
    Route::get('record/repairList','RepairRecord/repairMan');//获取维修工师傅列表
    Route::post('record/assign','RepairRecord/assignWorker');//分配维修工
    Route::post('Merchant/switchStores','Merchant/switchStores');//切换门店
    Route::any('Merchant/addExtra','Merchant/addExtra');//补充资料
    Route::any('Merchant/seeExtra','Merchant/seeExtra');//查看补充资料
    Route::post('merchant/updateInfo','Merchant/updateInfo');//更新商户营业执照信息
    Route::post('merchant/invoice/listNew','Merchant/invoiceListNew');//开票列表页
    Route::post('merchant/pay','Merchant/toPayCostPay');  //微信支付
    Route::post('merchant/sectionpay','Merchant/sectionPay');  //微信支付部分缴费
    Route::post('merchant/sectionpayList','Merchant/sectionPayList');  //微信支付部分缴费列表
    Route::post('merchant/balance','Merchant/balancePay');  //余额支付
    Route::post('merchant/BalancePay','Merchant/MergeBalancePay');  //多笔拉起余额支付
    Route::post('release/owe','release/oweCost');//管理查询商户欠费列表
    Route::post('merchant/costPay','Merchant/CostPay');  //    多笔拉起支付
    /*巡检*/
    Route::post('polling/add','Polling/upPolling');//巡检上报
    Route::post('polling/list','Polling/PollingList');//巡检列表
    Route::post('merchant/certificate/list','Merchant/certificateList');  //水电账单列表
    Route::post('merchant/certificate/detail','Merchant/certificateDetail');  //水电账单详情
    Route::post('merchant/cost','Merchant/toPayCost');  // 待缴费项
    Route::post('merchant/home/list','Merchant/HomeList');  //待缴费列表
    Route::post('merchant/detail','Merchant/toPayCostDetail');  //待缴费详情
    Route::post('merchant/top_up','Merchant/topUp');  //预缴费充值
    Route::post('merchant/top_up/list','Merchant/topUpList');  //充值记录
    Route::post('merchant/balance/info','Merchant/BalanceInfo');  //充值记录
    Route::post('merchant/bill','Merchant/uploadBillPay');  //上传票据支付
    Route::post('merchant/bills','Merchant/uploadBillPays');  //批量上传票据支付
    Route::post('merchant/balanceApply','Merchant/balanceApply');  //商户余额变更申请
    Route::any('merchant/getRole','Merchant/getRole');  //商户余额变更申请
    Route::get('bank_number','Merchant/getBankInfo');//获取转账银行信息
    Route::any('merchant/cost_audit_list','Merchant/costAuditList');//转账审核列表
    Route::any('merchant/cost_audit_detail','Merchant/costAuditDetail');//转账审核详情
    Route::post('record/merchant/list','RepairRecord/merchantRecordList');//商户端获取报修
    Route::post('close/ticketList','Close/getTicketList');//管理端获取罚单列表
    //商户入离场相关
    Route::any('release/getWatchList','release/getWatchList');  //获取商户下水电表
    Route::any('release/getUpWatchList','release/getUpWatchList');  //获取商户下水电表
    Route::any('release/submitWatch','release/submitWatch');  //抄表提交
    Route::any('release/searchWatch','release/searchWatch');  //搜索表信息
    Route::post('release/list','release/MerchantList');  //获取商户列表
    Route::any('merchant/getReadingList','merchant/getReadingList');  //商户入离场表绑定列表
    Route::any('merchant/ReadingConfirm','merchant/ReadingConfirm');  //商户入离场表绑定确认
    Route::any('release/getMerchantTask','release/getMerchantTask');  //管理获取商户上报任务列表
    Route::any('merchant/myBalance','merchant/myBalance');  //管理获取冻结详情
    Route::any('merchant/invoice/detailNew','Merchant/invoiceDetailNew');//发票详情页
    Route::post('balanceAudit/add','Merchant/balanceAdd');//余额充值转账
    Route::any('balanceAudit/list','Merchant/balanceList');//余额充值转账列表
    Route::post('merchant/getBalanceLog','Merchant/getBalanceLog');//余额充值凭证

})->middleware(\app\api\middleware\CheckApi::class);


//邮箱号注册
Route::post('register', 'v1.Member/register')->name('register');

//个人信息
Route::get('index', 'v1.Member/index')->name('index');

//更新密码
Route::post('update_pwd', 'v1.Member/updatePwd')->name('update_pwd');

Route::get('test', 'v1.Member/test')->name('test');



//miss 路由
Route::miss(function() {
    if(app()->request->isOptions()){
        return \think\Response::create('ok')->code(200)->header([
            'Access-Control-Allow-Origin' => '*',
            'Access-Control-Allow-Headers' => 'Authori-zation,Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With',
            'Access-Control-Allow-Methods' => 'GET,POST,PATCH,PUT,DELETE,OPTIONS,DELETE',
            ]);
    }else{
        return \think\Response::create()->code(404);
    }
});